package com.yangxk.kadmin.common.beans;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.github.pagehelper.PageInfo;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * 分页对象
 *
 * @author yangxk
 * @date 2019/2/12 13:43
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@Getter
@Setter
public class Page<T> {
    private int pageSize;
    private int pageNum;
    private long total;
    private List<T> list;

    /**
     * 构造分页对象
     * @param pageInfo pageHelper的分页对象
     */
    public Page(PageInfo pageInfo) {
        this.pageSize = pageInfo.getPageSize();
        this.pageNum = pageInfo.getPageNum();
        this.total = pageInfo.getTotal();
        this.list = pageInfo.getList();
    }

}